<!--
 * @Description: inmove 美元数值
 * @Author: Sun
 * @Date: 2019-07-28 16:56:21
 * @LastEditors: Sun
 * @LastEditTime: 2019-07-28 18:16:50
 -->


<template>
  <div class="mn">
    filters过滤属性
    <h4>{{ money | setmoney}}</h4>
    <div v-for="(val,index) in  cont" :key="index">
      <h4>{{val.title}} <span class="ty">赞👍{{val.like|setcontent|ren}}</span> </h4>

    </div>
  </div>
</template>

<script>
  export default {
    name: "inmove",
    data() {
      return {
        money: 300000000,
        cont: [{
            title: "nihao1",
            like: 2000
          },
          {
            title: "nihao2",
            like: 30000
          },
          {
            title: "nihao1",
            like: 4000
          },
          {
            title: "nihao1",
            like: 800
          },
          {
            title: "nihao1",
            like: 900000
          },
        ]
      }
    },
    created() {

    },
    methods: {

    },
    filters: {
      setmoney(val) {
        const sm = 10000
        if (val > 10000) {
          return (parseInt((val / sm) * sm) / sm) + "万美元"
        } else {
          return val + "美元"
        }
      },
      setcontent(val) {
        const sm = 10000
        if (val >= sm) {
          return (parseInt((val / sm) * sm) / sm) + "w"
        } else if (sm > val&&val>= 1000) {
          return (parseInt((val / 1000) * sm) / sm) + "k"
        } else {
          return val
        }
      },
      ren(val){
        return  val + "人喜欢"
      }
    },
    computed: {

    },
    watch: {

    },
    components: {

    }

  }
</script>

<style lang="scss" scoped>
  h4 {
    color: #fff
  }

  .mn {
    margin-top: 20px;
    color: #fff
  }

  .red,
  .ty {
    color: red;
  }

  .thin,
  .ty {
    font-weight: 200;
  }

  .italic {
    font-style: italic;
  }

  .ty {
    font-size: 20px;
  }

  .active {
    letter-spacing: 0.5em;
  }
</style>